package com.csii.test;

import java.io.FileInputStream;
import java.security.Key;
import java.security.KeyStore;
import java.security.cert.Certificate;


public class CertificateManagement {
	
	public static KeyEntry getKeyEntry(String paramString) throws Exception {
//		String jdField_if="D:\\home\\ap\\marketapp\\epaydomains\\jks\\ddbank.pfx";//keyStoreFileName
		String jdField_if="D:\\home\\ap\\marketapp\\epaydomains\\jks\\三维浩泰私钥证书.jks";
	    String jdField_for="111111";//keyStorePassword
		String jdField_do="111111";//keyPassword
		KeyStore jdField_int =KeyStore.getInstance("JKS");
		jdField_int.load(new FileInputStream(jdField_if),jdField_for.toCharArray());
		//jdField_int.load(null, jdField_for.toCharArray());
		Certificate[] arrayOfCertificate = jdField_int.getCertificateChain(paramString);
		Key localKey = jdField_int.getKey(paramString,jdField_do.toCharArray());
		KeyEntry localKeyEntry = new KeyEntry(localKey, arrayOfCertificate);
		return localKeyEntry;
	}


	public static class KeyEntry {
		private Key a;
		private Certificate[] jdField_if;

		public KeyEntry(Key paramKey, Certificate[] paramArrayOfCertificate) {
			this.a = paramKey;
			this.jdField_if = paramArrayOfCertificate;
		}

		public Certificate[] getCertificateChain() {
			return this.jdField_if;
		}

		public Key getKey() {
			return this.a;
		}
	}
	
	
	
	
}
